<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
    function saveAll(){
        $.ajax({
            type: "POST",
            url: '${ctx}/operation/operationCost/operationCostCreate',
            'contentType': 'application/json',
            dataType: "json",
            success: function (data) {
                console.log(data);
                if (data.code == "success") {
                    toastr.success('生成领药单成功');
                    $('#btnSubmit1').click();
                } else {
                    toastr.error(data.data);
                }
            },
            error: function (data) {
                console.log(data);
                toastr.error('网络连接错误,请检查网络');
            }
        });
    }
</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#">领药单详情</a>
            </li>
            <li>
                <a href="#" onclick="loadDiv('rightCenterDiv','${ctx}/operation/operationCost/operationCostCreateList')">
                    生成领药单
                </a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                    <div class="btn-group">
                        <button type="button" class="btn btn-info" onclick="saveAll()">生成领药单</button>
                    </div>
                <div class="table-responsive no-border">
                    <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                        <thead>
                        <tr>
                            <th>患者姓名</th>
                            <th>住院号</th>
                            <th>药品名</th>
                            <th>药品规格</th>
                            <th>药品单位</th>
                            <th>生产商</th>
                            <th>领药库房</th>
                            <th>数量</th>
                            <th>单价</th>
                            <th>金额</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${operationCostList}" var="operationCost">
                        <tr>
                            <td> ${operationCost.patientId}</td>
                            <th> ${operationCost.visitId}</th>
                            <td> ${operationCost.itemName}</td>
                            <td> ${operationCost.itemSpec}</td>
                            <td> ${operationCost.itemUnits}</td>
                            <td> ${operationCost.supplierName}</td>
                            <td> ${operationCost.storageId}</td>
                            <td> ${operationCost.amount}</td>
                            <td> ${operationCost.price}</td>
                            <td> ${operationCost.cost}</td>
                        </tr>
                        </c:forEach>
                    </table>
                </div>
            </div>
        </section>
    </div>
</div>